Skip to content

Fix validation error when battery_charge/discharge_power_curve is set to "auto" - #3728

Merged
springfall2008 merged 2 commits into
mainfrom
copilot/fix-auto-charge-discharge-error
Apr 3, 2026
Merged

springfall2008 merged 2 commits into
mainfrom
copilot/fix-auto-charge-discharge-error

Conversation

Copilot AI commented Apr 3, 2026 •

Copy link
Copy Markdown
Contributor

Setting battery_charge_power_curve: auto or battery_discharge_power_curve: auto in apps.yaml triggers validation errors because the schema only permits int_float_dict, despite "auto" being a valid runtime value that enables auto-detection.

Changes

  • config.py: Added "or_auto": True to the APPS_SCHEMA entries for both battery_charge_power_curve and battery_discharge_power_curve
  • predbat.py: Updated int_float_dict validation to accept "auto" when or_auto is set in the spec
  • tests/test_battery_curve_keys.py: Added test_validate_config_auto_curve to assert that setting both curves to "auto" introduces no additional validation errors
# Previously caused:
# Warn: Validation of apps.yaml found configuration item 'battery_charge_power_curve'
#       is not of type 'int_float_dict' value was auto
battery_charge_power_curve: auto
battery_discharge_power_curve: auto

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.octopus.energy
    • Triggering command: /home/REDACTED/work/batpred/batpred/coverage/venv/bin/python3 python3 ../apps/predbat/unit_test.py --quick git conf�� unset --global d/coverage/venv/bin/lsb_release user.name (dns block)
  • gitlab.com
    • Triggering command: /usr/lib/git-core/git-remote-https /usr/lib/git-core/git-remote-https origin REDACTED (dns block)
  • https://api.github.com/repos/springfall2008/batpred/contents/apps/predbat
    • Triggering command: /home/REDACTED/work/batpred/batpred/coverage/venv/bin/python3 python3 ../apps/predbat/unit_test.py --quick --test validate_config (http block)
    • Triggering command: /home/REDACTED/work/batpred/batpred/coverage/venv/bin/python3 python3 ../apps/predbat/unit_test.py --list (http block)
    • Triggering command: /home/REDACTED/work/batpred/batpred/coverage/venv/bin/python3 python3 ../apps/predbat/unit_test.py --quick --test fetch_config_options (http block)

If you need me to access, download, or install something from one of these locations, you can either:

…dation

Agent-Logs-Url: https://github.com/springfall2008/batpred/sessions/dae4c313-edf9-4c90-a5a6-a616b1bfa7fb

Co-authored-by: springfall2008 <48591903+springfall2008@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix auto charge and discharge error in apps.yaml Fix validation error when battery_charge/discharge_power_curve is set to "auto" Apr 3, 2026
Copilot AI requested a review from springfall2008 April 3, 2026 09:20
@springfall2008
springfall2008 marked this pull request as ready for review April 3, 2026 12:48
Copilot AI review requested due to automatic review settings April 3, 2026 12:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a config validation mismatch where battery_charge_power_curve: auto / battery_discharge_power_curve: auto are valid runtime values (triggering auto-detection), but previously failed schema validation.

Changes:

  • Allow "auto" as an alternative to int_float_dict for the two battery power curve config keys via a schema flag.
  • Extend validate_config()’s int_float_dict validation to accept "auto" when explicitly enabled by the schema.
  • Add a regression test ensuring both curve settings can be set to "auto" without increasing validation errors.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
apps/predbat/config.py Marks both battery power curve config keys as allowing "auto" during validation.
apps/predbat/predbat.py Updates int_float_dict validation to accept "auto" when spec["or_auto"] is set.
apps/predbat/tests/test_battery_curve_keys.py Adds a test to prevent regressions for "auto" curve validation.

@springfall2008
springfall2008 merged commit 4dc8e9c into main Apr 3, 2026
5 checks passed
@springfall2008
springfall2008 deleted the copilot/fix-auto-charge-discharge-error branch April 3, 2026 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto charge and discharge in apps.yaml creates and error

3 participants